﻿﻿<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="com.cchr.acms.model.CaseInfo"%>
<%@page import="com.cchr.acms.model.Action"%>
<%@page import="com.cchr.acms.model.AbuseType"%>
<%@page import="com.cchr.acms.util.HtmlComponentUtil.SelectOption"%>
<%@page import="java.util.List"%>
<%@page import="com.cchr.acms.util.HtmlComponentUtil"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"   pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.acms.com/acmstag" prefix="acms" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%
	String contextPath = request.getContextPath();
	CaseInfo caseInfo = (CaseInfo)request.getAttribute("caseInfo");
%>
	<style>
<!--
body{
	color:black;
}

.page-signup-alt .form-header
{
	margin: 20px 0;
}

.form-group
{
	margin-bottom: 8px;
}

-->
</style>
	<!-- Form -->
	<form class="panel form-horizontal" id="jq-validation-form" method="POST" style="width:1000px">
		<div class="row">
			<div class="col-sm-4">
				<div class="form-group no-margin-hr">
					<label class="control-label"><fmt:formatDate value="${caseInfo.createDate}" pattern="EEE, MMM d, yyyy"/></label>
					<div class="input-group">
					</div>
				</div>
			</div>	
			<div class="col-sm-6">
			</div>	
			<div class="col-sm-2">
				<div class="form-group no-margin-hr">
						<input type="submit"  style="width:110px;border-radius:0px;padding: 7px" value="Save" class="btn btn-primary btn-lg btn-block">
				</div>
			</div>	
		</div>
		
		<div class="row">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="control-label"><h1 class="form-header"><strong>Information on the Person Abused:</strong></h1></label>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-4">
				<div class="form-group no-margin-hr">
					<label class="control-label">First Name</label>
					<input type="text" class="form-control" name="abusedPerson.firstName"  placeholder="First Name" value="${caseInfo.abusedPerson.firstName}">
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group no-margin-hr">
					<label class="control-label">Middle Name</label>
					<input type="text" class="form-control" name="abusedPerson.middleName" placeholder="Middle Name" value="${caseInfo.abusedPerson.middleName}">
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group no-margin-hr">
					<label class="control-label">Last Name</label>
					<input type="text" class="form-control" name="abusedPerson.lastName"  placeholder="Last Name" value="${caseInfo.abusedPerson.lastName}">
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="control-label">Street Address</label>
					<input type="text" class="form-control" name="abusedPerson.streetAddress" placeholder="Street Address" value="${caseInfo.abusedPerson.streetAddress}">
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-3">
				<div class="form-group no-margin-hr">
					<label class="control-label">City</label>
					<input type="text" class="form-control" name="abusedPerson.city"  placeholder="City" value="${caseInfo.abusedPerson.city}">
				</div>
			</div>
			<div class="col-sm-3">
				<div class="form-group no-margin-hr">
					<label class="control-label">State/Province</label>
					<input type="text" class="form-control" name="abusedPerson.state"  placeholder="State/Province" value="${caseInfo.abusedPerson.state}">
				</div>
			</div>
			<div class="col-sm-3">
				<div class="form-group no-margin-hr">
					<label class="control-label">Zip/Postal Code</label>
					<input type="text" class="form-control" name="abusedPerson.zip" placeholder="Zip/Postal Code" value="${caseInfo.abusedPerson.zip}">
				</div>
			</div>
			<div class="col-sm-3">
				<div class="form-group no-margin-hr">
					<label class="control-label">Country</label>
					<%= HtmlComponentUtil.getSelect("abusedPersonCountry", "abusedPerson.country", (List<SelectOption>)request.getAttribute("countryDatas"), caseInfo.getAbusedPerson().getCountry(), "Choose Country...") %>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-6">
				<div class="form-group no-margin-hr">
					<label class="control-label">Phone Number</label>
					<input type="text" class="form-control" name="abusedPerson.telephone" placeholder="Phone Number" value="${caseInfo.abusedPerson.telephone}">
				</div>
			</div>
			<div class="col-sm-6">
				<div class="form-group no-margin-hr">
					<label class="control-label">Email Address</label>
					<input type="text" class="form-control" name="abusedPerson.email" placeholder="Email Address" value="${caseInfo.abusedPerson.email}">
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-6">
				<div class="form-group no-margin-hr">
					<label class="control-label">Birth Date of Abused</label>
					<div class="input-group date bs-datepicker-component" >
						<input type="text" class="form-control" name="abusedPerson.birthDay" value="<fmt:formatDate value="${caseInfo.abusedPerson.birthDay}" pattern="MM/dd/yyyy"/>"><span class="input-group-addon"><i class="fa fa-calendar"></i></span>
					</div>
				</div>
			</div>
			<div class="col-sm-6">
				<div class="form-group no-margin-hr">
					<label class="control-label">Or Approx. Age</label>
					<select class="form-control unRender" name="abusedPerson.age">
						<c:forEach var="item" varStatus="status" begin="1" end="150">
							<c:choose>
								<c:when test="${caseInfo.abusedPerson.age == item}">
									<option value="${item }" selected="selected">${item }</option>
								</c:when>
								<c:otherwise>
									<option value="${item }">${item }</option>
								</c:otherwise>
							</c:choose>
						</c:forEach>
					</select>
					
				</div>
			</div>
		</div>
	
			<label class="control-label">Approximate Date Abuse Occurred</label>
			<div class="row">
					<div class="col-sm-5">
						<div class="input-group date bs-datepicker-component">
						<input type="text" class="form-control" name="caseStart" value="<fmt:formatDate value="${caseInfo.caseStart}" pattern="MM/dd/yyyy"/>"><span class="input-group-addon"><i class="fa fa-calendar"></i></span>
					</div>
								
					</div>
					<div class="col-sm-2" align="center">
						<span>To</span>
					</div>
					<div class="col-sm-5">
						<div class="input-group date bs-datepicker-component">
						<input type="text" class="form-control" name="caseEnd" value="<fmt:formatDate value="${caseInfo.caseEnd}" pattern="MM/dd/yyyy"/>"><span class="input-group-addon"><i class="fa fa-calendar"></i></span>
					    </div>
					</div>
			</div>
		<hr>
			
		<div class="row">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="control-label"><h1 class="form-header"><strong>Information on the Person Reporting the Abuse (if different than above):</strong></h1></label>
					<acms:yesNoSelect name="differentAbusedPerson" selected="${caseInfo.differentAbusedPerson }" clazz="unRender" id="differentAbusedPerson"/>
				</div>
			</div>
		</div>
		<div id="differentAbusedPersonForm"  style="display: none;">
		<div class="row">
			<div class="col-sm-6">
				<div class="form-group no-margin-hr">
					<label class="control-label">Relation to the Abused Person</label>
					<%= HtmlComponentUtil.getSelect("reportedByRelation", "reportedBy.relation", (List<SelectOption>)request.getAttribute("relations"), caseInfo.getReportedBy().getRelation(), "Select a relation") %>
				</div>
			</div>
			<div class="col-sm-6">
				<div class="form-group no-margin-hr">
					<label class="control-label">If other, please explain</label>
					<c:choose>
						<c:when test="${caseInfo.reportedBy.relation == 'Other'}">
							<input type="text" id="reportedByRelationOther" class="form-control" name="reportedBy.relationOther" value="${caseInfo.reportedBy.relationOther}">
						</c:when>
						<c:otherwise>
							<input type="text" disabled="disabled" id="reportedByRelationOther" class="form-control" name="reportedBy.relationOther">
						</c:otherwise>
					</c:choose>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-4">
				<div class="form-group no-margin-hr">
					<label class="control-label">First Name</label>
					<input type="text" class="form-control" name="reportedBy.firstName" placeholder="First Name" value="${caseInfo.reportedBy.firstName}">
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group no-margin-hr">
					<label class="control-label">Middle Name</label>
					<input type="text" class="form-control" name="reportedBy.middleName" placeholder="Middle Name" value="${caseInfo.reportedBy.middleName}">
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group no-margin-hr">
					<label class="control-label">Last Name</label>
					<input type="text" class="form-control" name="reportedBy.lastName" placeholder="Last Name" value="${caseInfo.reportedBy.lastName}">
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="control-label">Street Address</label>
					<input type="text" class="form-control" id="jq-validation-username" name="reportedBy.streetAddress" placeholder="Street Address" value="${caseInfo.reportedBy.streetAddress}">
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-3">
				<div class="form-group no-margin-hr">
					<label class="control-label">City</label>
					<input type="text" class="form-control" name="reportedBy.city" placeholder="City" value="${caseInfo.reportedBy.city}">
				</div>
			</div>
			<div class="col-sm-3">
				<div class="form-group no-margin-hr">
					<label class="control-label">State/Province</label>
					<input type="text" class="form-control" name="reportedBy.state" placeholder="State/Province" value="${caseInfo.reportedBy.state}">
				</div>
			</div>
			<div class="col-sm-3">
				<div class="form-group no-margin-hr">
					<label class="control-label">Zip/Postal Code</label>
					<input type="text" class="form-control" name="reportedBy.zip" placeholder="Zip/Postal Code" value="${caseInfo.reportedBy.zip}">
				</div>
			</div>
			<div class="col-sm-3">
				<div class="form-group no-margin-hr">
					<label class="control-label">Country</label>
					<%= HtmlComponentUtil.getSelect("reportCountry", "reportedBy.country", (List<SelectOption>)request.getAttribute("countryDatas"), caseInfo.getReportedBy().getCountry(), "choose country...") %>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-6">
				<div class="form-group no-margin-hr">
					<label class="control-label">Phone Number</label>
					<input type="text" class="form-control" name="reportedBy.telephone" placeholder="Phone Number" value="${caseInfo.reportedBy.telephone}">
				</div>
			</div>
			<div class="col-sm-6">
				<div class="form-group no-margin-hr">
					<label class="control-label">Email Address</label>
					<input type="text" class="form-control" name="reportedBy.email" placeholder="Email Address" value="${caseInfo.reportedBy.email}">
				</div>
			</div>
		</div>
		</div>
		<hr>
		
		<%
			List<AbuseType> abuseTypes = (List<AbuseType>)request.getAttribute("abuseTypes");
			List<String> typeIds = (List<String>)request.getAttribute("typeIds");
			if(abuseTypes != null)
			{
				for(int i=0; i<abuseTypes.size(); i++)
				{
					if(i%4 == 0)
					{
		%>
					<div class="row">
						<div class="col-sm-3">
							<div class="form-group no-margin-hr">
								<label class="control-label"><%=(i == 0 ? "Type of Abuse That Occurred<br>(Check as many as apply)" : "") %></label>					
							</div>
						</div>
		<%
					}
		%>
						<div class="col-sm-2">
							<div class="form-group no-margin-hr">
								<label class="checkbox-inline">
									<input type="checkbox" class="px" <%= typeIds.contains(abuseTypes.get(i).getId() + "") ? "checked=\"checked\"" : "" %> value="<%=abuseTypes.get(i).getId() %>" name="abusetypeCheckbox"> <span class="lbl"><%=abuseTypes.get(i).getName() %></span>
								</label>			
							</div>
						</div>
		<%						
					if(i%4 == 3 || i == abuseTypes.size() - 1)
					{
		%>
					</div>
		<%				
					}
				}
			}
		%>
		<hr>
		<div class="row">
			<div class="col-sm-3">
				<div class="form-group no-margin-hr">
					<label class="control-label">Summary of Abuse That Occurred</label>				
				</div>
			</div>
			<div class="col-sm-9">
				<div class="form-group no-margin-hr">
					<textarea rows="3" class="form-control" name="summary"  placeholder="1000 characters max">${caseInfo.summary}</textarea>
				</div>
			</div>
		</div>
		<hr>
		<div class="row">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="control-label"><h1 class="form-header" style="margin-bottom:10px; margin-top:10px"><strong>Facilities Where the Abuse Occurred:</strong></h1></label>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-6" style="border:1px solid #c2c2c2;padding-top:10px;border-right:0px">
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">#1 - Facility Type</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<%= HtmlComponentUtil.getSelect("facilityInfosType1", "facilityInfos[0].type", (List<SelectOption>)request.getAttribute("facilityTypes"), caseInfo.getFacilityInfos().get(0).getType(), "Select an Option") %>
						</div>
					</div>
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">If other, please explain</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<c:choose>
								<c:when test="${caseInfo.facilityInfos[0].type == 'Other'}">
									<input type="text" id="facilityInfosTypeOther1" class="form-control" name="facilityInfos[0].typeOther"  value="${caseInfo.facilityInfos[0].typeOther}">
								</c:when>
								<c:otherwise>
									<input type="text" disabled="disabled" id="facilityInfosTypeOther1" class="form-control" name="facilityInfos[0].typeOther">
								</c:otherwise>
							</c:choose>
						</div>
					</div>
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">Facility Name</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="facilityInfos[0].name" placeholder="Facility Name" value="${caseInfo.facilityInfos[0].name}">
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">Street Address</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="facilityInfos[0].streetAddress" placeholder="Street Address" value="${caseInfo.facilityInfos[0].streetAddress}">
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-1">
						<div class="form-group no-margin-hr">
							<label class="control-label">City</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="facilityInfos[0].city" placeholder="City" value="${caseInfo.facilityInfos[0].city}">
						</div>
					</div>
					<div class="col-sm-3">
						<div class="form-group no-margin-hr">
							<label class="control-label">State/Province</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="facilityInfos[0].state" placeholder="State/Province" value="${caseInfo.facilityInfos[0].state}">
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-2">
						<div class="form-group no-margin-hr">
							<label class="control-label">Zip/Postal Code</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="facilityInfos[0].zip" placeholder="Zip/Postal Code" value="${caseInfo.facilityInfos[0].zip}">
						</div>
					</div>
					<div class="col-sm-2">
						<div class="form-group no-margin-hr">
							<label class="control-label">Country</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<%= HtmlComponentUtil.getSelect("facilitiesCountry1", "facilityInfos[0].country", (List<SelectOption>)request.getAttribute("countryDatas"), caseInfo.getFacilityInfos().get(0).getCountry(), "Choose Country...") %>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">Phone Number</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="facilityInfos[0].telephone" placeholder="Phone Number" value="${caseInfo.facilityInfos[0].telephone}">
						</div>
					</div>
				</div>
			</div>
			<div class="col-sm-6" style="border:1px solid #c2c2c2;padding-top:10px">
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">#2 - Facility Type</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<%= HtmlComponentUtil.getSelect("facilityInfosType2", "facilityInfos[1].type", (List<SelectOption>)request.getAttribute("facilityTypes"), caseInfo.getFacilityInfos().get(1).getType(), "Select an Option") %>
						</div>
					</div>
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">If other, please explain</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<c:choose>
								<c:when test="${caseInfo.facilityInfos[1].type == 'Other'}">
									<input type="text" id="facilityInfosTypeOther2" class="form-control" name="facilityInfos[1].typeOther" value="${caseInfo.facilityInfos[1].typeOther}">
								</c:when>
								<c:otherwise>
									<input type="text" disabled="disabled" id="facilityInfosTypeOther2" class="form-control" name="facilityInfos[1].typeOther">
								</c:otherwise>
							</c:choose>
						</div>
					</div>
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">Facility Name</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="facilityInfos[1].name" placeholder="Facility Name" value="${caseInfo.facilityInfos[1].name}">
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">Street Address</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="facilityInfos[1].streetAddress" placeholder="Street Address" value="${caseInfo.facilityInfos[1].streetAddress}">
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-1">
						<div class="form-group no-margin-hr">
							<label class="control-label">City</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="facilityInfos[1].city" placeholder="City" value="${caseInfo.facilityInfos[1].city}">
						</div>
					</div>
					<div class="col-sm-3">
						<div class="form-group no-margin-hr">
							<label class="control-label">State/Province</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="facilityInfos[1].state" placeholder="State/Province" value="${caseInfo.facilityInfos[1].state}">
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-2">
						<div class="form-group no-margin-hr">
							<label class="control-label">Zip/Postal Code</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="facilityInfos[1].zip" placeholder="Zip/Postal Code" value="${caseInfo.facilityInfos[1].zip}">
						</div>
					</div>
					<div class="col-sm-2">
						<div class="form-group no-margin-hr">
							<label class="control-label">Country</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<%= HtmlComponentUtil.getSelect("facilitiesCountry2", "facilityInfos[1].country", (List<SelectOption>)request.getAttribute("countryDatas"), caseInfo.getFacilityInfos().get(1).getCountry(), "Choose Country...") %>
					</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">Phone Number</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="facilityInfos[1].telephone" placeholder="Phone Number" value="${caseInfo.facilityInfos[1].telephone}">
						</div>
					</div>
				</div>
			</div>
		</div>
		<hr>
		<div class="row">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="control-label"><h1 class="form-header" style="margin-bottom:10px; margin-top:10px"><strong>Doctors Who Were Involved With the Abuse:</strong></h1></label>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-6" style="border:1px solid #c2c2c2;padding-top:10px;border-right:0px">
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">#1 - Doctor First Name</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="doctorInfos[0].name" placeholder="Doctor First Name" value="${caseInfo.doctorInfos[0].name}">
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">#1 - Doctor Last Name</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="doctorInfos[0].lastName" placeholder="Doctor Last Name" value="${caseInfo.doctorInfos[0].lastName}">
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">#1 - Doctor Type</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<%= HtmlComponentUtil.getSelect("doctorInfos1", "doctorInfos[0].docType", (List<SelectOption>)request.getAttribute("docTypes"), caseInfo.getDoctorInfos().get(0).getDocType(), "Choose a Doctor Type...") %>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">Street Address</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="doctorInfos[0].streetAddress" placeholder="Street Address" value="${caseInfo.doctorInfos[0].streetAddress}">
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-1">
						<div class="form-group no-margin-hr">
							<label class="control-label">City</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="doctorInfos[0].city" placeholder="City" value="${caseInfo.doctorInfos[0].city}">
						</div>
					</div>
					<div class="col-sm-3">
						<div class="form-group no-margin-hr">
							<label class="control-label">State/Province</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="doctorInfos[0].state" placeholder="State/Province" value="${caseInfo.doctorInfos[0].state}">
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-2">
						<div class="form-group no-margin-hr">
							<label class="control-label">Zip/Postal Code</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="doctorInfos[0].zip" placeholder="Zip/Postal Code" value="${caseInfo.doctorInfos[0].zip}">
						</div>
					</div>
					<div class="col-sm-2">
						<div class="form-group no-margin-hr">
							<label class="control-label">Country</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<%= HtmlComponentUtil.getSelect("doctorCountry1", "doctorInfos[0].country", (List<SelectOption>)request.getAttribute("countryDatas"), caseInfo.getDoctorInfos().get(0).getCountry(), "Choose Country...") %>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">Phone Number</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="doctorInfos[0].telephone" placeholder="Phone Number" value="${caseInfo.doctorInfos[0].telephone}">
						</div>
					</div>
				</div>
			</div>
			<div class="col-sm-6"  style="border:1px solid #c2c2c2;padding-top:10px;">
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">#2 - Doctor First Name</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="doctorInfos[1].name" placeholder="Doctor First Name" value="${caseInfo.doctorInfos[1].name}">
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">#2 - Doctor Last Name</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="doctorInfos[1].lastName" placeholder="Doctor Last Name" value="${caseInfo.doctorInfos[1].lastName}">
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">#2 - Doctor Type</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<%= HtmlComponentUtil.getSelect("doctorInfos2", "doctorInfos[1].docType", (List<SelectOption>)request.getAttribute("docTypes"), caseInfo.getDoctorInfos().get(1).getDocType(), "Choose a Doctor Type...") %>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">Street Address</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="doctorInfos[1].streetAddress" placeholder="Street Address" value="${caseInfo.doctorInfos[1].streetAddress}">
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-1">
						<div class="form-group no-margin-hr">
							<label class="control-label">City</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="doctorInfos[1].city" placeholder="City" value="${caseInfo.doctorInfos[1].city}">
						</div>
					</div>
					<div class="col-sm-3">
						<div class="form-group no-margin-hr">
							<label class="control-label">State/Province</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="doctorInfos[1].state" placeholder="State/Province" value="${caseInfo.doctorInfos[1].state}">
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-2">
						<div class="form-group no-margin-hr">
							<label class="control-label">Zip/Postal Code</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="doctorInfos[1].zip" placeholder="Zip/Postal Code" value="${caseInfo.doctorInfos[1].zip}">
						</div>
					</div>
					<div class="col-sm-2">
						<div class="form-group no-margin-hr">
							<label class="control-label">Country</label>
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group no-margin-hr">
							<%= HtmlComponentUtil.getSelect("doctorCountry2", "doctorInfos[1].country", (List<SelectOption>)request.getAttribute("countryDatas"), caseInfo.getDoctorInfos().get(1).getCountry(), "Choose Country...") %>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-sm-5">
						<div class="form-group no-margin-hr">
							<label class="control-label">Phone Number</label>
						</div>
					</div>
					<div class="col-sm-7">
						<div class="form-group no-margin-hr">
							<input type="text" class="form-control" name="doctorInfos[1].telephone" placeholder="Phone Number" value="${caseInfo.doctorInfos[1].telephone}">
						</div>
					</div>
				</div>
			</div>
		</div>
		<hr>
		<div class="row">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="control-label"><h1 class="form-header" style="margin-bottom:10px; margin-top:10px">Did the Abused Person Use Insurance?</h1></label>
					<acms:yesNoSelect name="userInsurance" id="userInsurance" clazz="unRender" selected="${caseInfo.userInsurance }"/>
				</div>
			</div>
		</div>
		<div class="row userInsurance-form">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="control-label"><h1 class="form-header" style="margin-bottom:10px; margin-top:10px">What Type Was Used?</h1></label>
				</div>
			</div>
		</div>
	 	<div class="row userInsurance-form">
			<c:forEach var="type" items="${insuranceType }">  
	     			<div class="col-sm-3">
						<div class="form-group no-margin-hr">
							<label class="checkbox-inline">
								<c:choose>
									<c:when test="${fn:contains(caseInfo.insuranceType, type)}">
										<input type="checkbox" class="px" value="${type }" name="insuranceTypeCheckbox" checked="checked"> 
									</c:when>
									<c:otherwise>
										<input type="checkbox" class="px" value="${type }" name="insuranceTypeCheckbox"> 
									</c:otherwise>
								</c:choose>
								<span class="lbl">${type }</span>
							</label>			
						</div>
					</div> 
   			</c:forEach>			
		</div>
		<div class="row userInsurance-form">
			<div class="col-sm-12">
				<div class="row">
					<div class="col-sm-3">
						<div class="form-group no-margin-hr">
							<label class="control-label">Insurance Company Name:</label>
						</div>
					</div>
					<div class="col-sm-9">
						<input type="text" class="form-control" name="insurance1CompanyName" value="${caseInfo.insurance1CompanyName }" placeholder="Insurance Company Name">
					</div>
				</div>
			</div>
		</div>
		<div class="row userInsurance-form">
			<div class="col-sm-3">
				<div class="form-group no-margin-hr">
					<label class="control-label">Notes on Insurance Details</label>				
				</div>
			</div>
			<div class="col-sm-9">
				<div class="form-group no-margin-hr">
					<textarea rows="3" class="form-control" name="notesOnInsuranceDetail">${caseInfo.notesOnInsuranceDetail }</textarea>
				</div>
			</div>
		</div>
		<hr>
		<div class="row">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="control-label"><h1 class="form-header" style="margin-bottom:10px; margin-top:10px"><strong>Were Psychiatric Drugs Prescribed?</strong></h1></label>
					<acms:yesNoSelect name="drugsPrescribed" selected="${caseInfo.drugsPrescribed }"  clazz="unRender" id="PrescribedDrugs"/>
				</div>
			</div>
		</div>
		<div class="row drug-form" style="display:none;">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="control-label"><h1 class="form-header" style="margin-bottom:10px; margin-top:10px"><strong>What Psychiatric Drugs Were Prescribed?</strong></h1></label>
				</div>
			</div>
		</div>
		<div class="row drug-form">
			<div class="col-sm-4">
				<div class="form-group no-margin-hr">
					<label class="control-label">How long were the drugs taken for?</label>				
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group no-margin-hr">
					<input type="text" class="form-control" name="drugsTakeTime" value="${caseInfo.drugsTakeTime}">
				</div>
			</div>
		</div>
		<div class="row drug-form">
			<div class="col-sm-4">
				<div class="form-group no-margin-hr">
					<label class="control-label">What dosage was prescribed?</label>				
				</div>
			</div>
			<div class="col-sm-4">
				<div class="form-group no-margin-hr">
					<input type="text" class="form-control" name="drugsDosage" value="${caseInfo.drugsDosage}">
				</div>
			</div>
		</div>
		<div class="row drug-form" style="display:none;">
			<%
				List<String> drugIdList = (List<String>)request.getAttribute("drugIdList");
				for(int i=1; i<=6; i++)
				{
					String drugId = "0";
					if(drugIdList.size() >= i)
					{
						drugId = drugIdList.get(i - 1);
					}
			%>
				<div class="col-sm-1">
					<div class="form-group no-margin-hr">
						<label class="control-label">#<%=i %></label>		
					</div>
				</div>
				<div class="col-sm-3">
					<div class="form-group no-margin-hr">
						<%= HtmlComponentUtil.getSelect("id_" + i, "drugIds", (List<SelectOption>)request.getAttribute("datas"), drugId, "Select an Option") %>
					</div>
				</div>
			<%
				}
			%>
		</div>
		<div class="row drug-form">
			<div class="form-group no-margin-hr">
				<label class="col-sm-4 control-label" style="color: black">Are you/they still taking psychiatric drugs?</label>
				<div class="col-sm-1">
					<acms:yesNoSelect name="stillTakeDrugs" selected="${caseInfo.stillTakeDrugs }" clazz="unRender" id="stillTakeDrugs" style="margin-top: 10px"/>
				</div>
			</div>
		</div>
		<hr>
		<div class="row">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="control-label"><h1 class="form-header" style="margin-bottom:10px; margin-top:10px"><strong>Are You Working With an Attorney?</strong></h1></label>
					<acms:yesNoSelect name="attorney.workWithAttorney" selected="${caseInfo.attorney.workWithAttorney }"  clazz="unRender" id="attorneyWorkWithAttorney"/>
				</div>
			</div>
		</div>
		<div class="row attorney-form" style="display: none;">
			<div class="form-group no-margin-hr">
				<label class="col-sm-2 control-label">Attorney Name</label>
				<div class="col-sm-10">
					<input type="text" class="form-control" name="attorney.name" placeholder="Attorney Name" value="${caseInfo.attorney.name}">
				</div>
			</div>
			<div class="form-group no-margin-hr">
				<label class="col-sm-2 control-label">Street Address</label>
				<div class="col-sm-4">
					<input type="text" class="form-control" name="attorney.streetAddress" placeholder="Street Address" value="${caseInfo.attorney.streetAddress}">
				</div>
				<label class="col-sm-2 control-label">City</label>
				<div class="col-sm-4">
					<input type="text" class="form-control" name="attorney.city" placeholder="City" value="${caseInfo.attorney.city}">
				</div>
			</div>
			<div class="form-group no-margin-hr">
				<label class="col-sm-2 control-label">State/Province</label>
				<div class="col-sm-4">
					<input type="text" class="form-control" name="attorney.state" placeholder="State/Province" value="${caseInfo.attorney.state}">
				</div>
				<label class="col-sm-2 control-label">Zip/Postal Code</label>	
				<div class="col-sm-4">
					<input type="text" class="form-control" name="attorney.zip" placeholder="Zip/Postal Code" value="${caseInfo.attorney.zip}">
				</div>
			</div>
			<div class="form-group no-margin-hr">
				<label class="col-sm-2 control-label">Country</label>
				<div class="col-sm-4">
					<%= HtmlComponentUtil.getSelect("attorneyCountry", "attorney.country", (List<SelectOption>)request.getAttribute("countryDatas"), caseInfo.getAttorney().getCountry(), "Choose Country...") %>
				</div>
				<label class="col-sm-2 control-label">Phone Number</label>
				<div class="col-sm-4">
					<input type="text"  class="form-control" name="attorney.telephone" placeholder="Phone Number" value="${caseInfo.attorney.telephone}">
				</div>
			</div>
			<div class="form-group no-margin-hr">
				<label class="col-sm-2 control-label">Email Address</label>
				<div class="col-sm-4">
					<input type="text" class="form-control" name="attorney.email" placeholder="Email Address" value="${caseInfo.attorney.email}">
				</div>
				<label class="col-sm-2 control-label">Current Status of Case</label>
				<div class="col-sm-4">
					<input type="text" class="form-control" name="attorney.status" placeholder="Current Status of Case" value="${caseInfo.attorney.status}">
				</div>
			</div>
		</div>
		<div class="row" id="assistanceAttorney-form">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="control-label"><h1 class="form-header" style="margin-bottom:10px; margin-top:10px"><strong>Would Like Assistance in Getting an Attorney to File Charges or Represent Your Case?</strong></h1></label>
					<c:choose>
						<c:when test="${caseInfo.attorney.assistanceAttorney == '1'}">
							<input type="checkbox" value="1"  name="attorney.assistanceAttorney" checked="checked">
						</c:when>
						<c:otherwise>
							<input type="checkbox" value="1"  name="attorney.assistanceAttorney">
						</c:otherwise>
					</c:choose>
				</div>
			</div>
		</div>
		<hr>
		<div class="row">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="control-label"><h1 class="form-header" style="margin-bottom:10px; margin-top:10px"><strong>What Actions Are You Interested in Taking on This Case?</strong></h1></label>
				</div>
			</div>
		</div>
		<%
			List<Action> actions = (List<Action>)request.getAttribute("actions");
			List<String> actionIdList = (List<String>)request.getAttribute("actionIdList");
			if(actions != null)
			{
				for(Action action : actions)
				{
		%>
			<div class="row">
				<div class="col-sm-12">
					<div class="form-group no-margin-hr">
						<label class="checkbox-inline">
							<input type="checkbox" class="px" value="<%=action.getId() %>" <%=actionIdList.contains(action.getId() + "") ? "checked=\"checked\"" : "" %> name="actionsCheckbox"> 
							<span class="lbl"><%=action.getName() %></span>
						</label>			
					</div>
				</div>
			</div>
		<%
				}
			}
		%>
		
		<div class="row">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="checkbox-inline">
						<input type="checkbox" class="px" id="otherActionCheck" <%=!StringUtils.isEmpty(caseInfo.getOtherAction()) ? "checked=\"checked\"" : "" %> > <span class="lbl"><input type="text" id="otherActionInput" <%=!StringUtils.isEmpty(caseInfo.getOtherAction()) ? "" : "disabled=\"disabled\"" %> class="form-control" name="otherAction" placeholder="Other" value="${caseInfo.otherAction}"></span>
					</label>			
				</div>
			</div>
		</div>
		
		<hr>
			<div class="row">
			<div class="col-sm-12">
				<div class="form-group no-margin-hr">
					<label class="control-label"><h1 class="form-header" style="margin-bottom:10px; margin-top:10px"><strong>Preferred Contact</strong></h1></label>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-6">
				<div class="input-group">
					<label class="control-label">Best time to contact you?</label>
					<input type="text" class="form-control" name="bestTimeToContact" placeholder="Best Time" value="${caseInfo.bestTimeToContact}">
				</div>
			</div>
			<div class="col-sm-6">
				<div class="form-group no-margin-hr">
					<label class="control-label">Best way to contact you?</label>
					<input type="text" class="form-control" name="bestWayToContact" placeholder="Best Way" value="${caseInfo.bestWayToContact}">
				</div>
			</div>
		</div>
		<br>
		<div class="row">
			<div class="col-sm-3">
			</div>
			<div class="col-sm-6" style="text-align:center;">
				<input type="submit"  style="width:110px;border-radius:0px;" value="Save" class="btn btn-primary btn-lg">
			</div>
		</div>
		</form>
		
		<div id="uidemo-modals-alerts-success" class="modal modal-alert modal-success fade">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<i class="fa fa-check-circle"></i>
					</div>
					<div class="modal-title"  id="successMsg">Case info saved successfully!</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-success submitConfim" style="border-radius:0px;width:110px;" onClick="$('#uidemo-modals-alerts-success').modal('hide');">OK</button>
					</div>
				</div> <!-- / .modal-content -->
			</div> <!-- / .modal-dialog -->
		</div>

<!-- Javascript -->
	<script>
    
		init.push(function () {

			$("#signup-form_id").validate({ focusInvalid: true, errorPlacement: function () {} });
			
			var options1 = {
					autoclose: true
				}
			$('.bs-datepicker-component').datepicker(options1);
			
			var options2 = {
				orientation: $('body').hasClass('right-to-left') ? "auto right" : 'auto auto',
				autoclose: true
						
			}
			$('#bs-datepicker-range').datepicker(options2);
			
			$("select:not(.unRender)").select2({
			    allowClear: true
			});

			$('#otherActionCheck').click(function(){
				if($('#otherActionCheck')[0].checked)
				{
					$('#otherActionInput').attr('disabled', false);
				}
				else
				{
					$('#otherActionInput').attr('disabled', true);
					$('#otherActionInput').val('');
				}
			});

			$('#reportedByRelation').change(function(){
				if($(this).val() == 'Other')
				{
					$('#reportedByRelationOther').attr('disabled', false);
				}
				else
				{
					$('#reportedByRelationOther').attr('disabled', true);
					$('#reportedByRelationOther').val('');
				}
			});

			$('#facilityInfosType1').change(function(){
				if($(this).val() == 'Other')
				{
					$('#facilityInfosTypeOther1').attr('disabled', false);
				}
				else
				{
					$('#facilityInfosTypeOther1').attr('disabled', true);
					$('#facilityInfosTypeOther1').val('');
				}
			});

			$('#facilityInfosType2').change(function(){
				if($(this).val() == 'Other')
				{
					$('#facilityInfosTypeOther2').attr('disabled', false);
				}
				else
				{
					$('#facilityInfosTypeOther2').attr('disabled', true);
					$('#facilityInfosTypeOther2').val('');
				}
			});
			
			function showOrHide(target, clazz)
			{
				if($(target).val() == '0')
				{
					$(clazz).hide();
				}
				else
				{
					$(clazz).show();
				}
				if($(target).attr('id') == 'attorneyWorkWithAttorney')
				{
					if($(target).val() == '0')
					{
						$('#assistanceAttorney-form').show();
					}
					else
					{
						$('#assistanceAttorney-form').hide();
					}
				}
			}
			
			$('#attorneyWorkWithAttorney').change(function(){
				showOrHide(this, '.attorney-form');
			});
			
			$('#differentAbusedPerson').change(function(){
				showOrHide(this, '#differentAbusedPersonForm');
			});
			
			$('#PrescribedDrugs').change(function(){
				showOrHide(this, '.drug-form');
			});
			
			$('#userInsurance').change(function(){
				showOrHide(this, '.userInsurance-form');
			});
			
			showOrHide($('#attorneyWorkWithAttorney'), '.attorney-form');
			showOrHide($('#differentAbusedPerson'), '#differentAbusedPersonForm');
			showOrHide($('#PrescribedDrugs'), '.drug-form');
			showOrHide($('#userInsurance'), '.userInsurance-form');
			
			$("#jq-validation-form").validate({
				ignore: '.ignore',
				focusInvalid: true,
				rules: {
					'abusedPerson.firstName': {
						required: true
					},
					'abusedPerson.city': {
						required: true
					},
					'abusedPerson.telephone': {
						required: true
					},
					'abusedPerson.email': {
					  required: true,
					  email: true
					},
				}
			});
			
			
		});
	</script>
